package project.configuration.instructions;

import project.layer.physical.Crossroad;
import project.layer.physical.Package;
import project.layer.physical.PickUpPoint;
import framework.instructions.creation.CreateInstruction;

public class CreatePickUpPointInstruction extends CreateInstruction{

	private Crossroad crossroad;
	
	private int packageId;
	
	public CreatePickUpPointInstruction(long executionTime,int objectId,Crossroad crossroad,int packageId){
		super(executionTime,objectId);
		this.crossroad = crossroad;
		this.packageId = packageId;
	}
	@Override
	protected Object createObject() {
		Package pack = getInstructionManager().findSpecificObject(Package.class, packageId);
		PickUpPoint pickUpPoint = new PickUpPoint();
		pickUpPoint.setPdpPackage(pack);
		crossroad.setPickUpPoint(pickUpPoint);
		pickUpPoint.setConnector(crossroad);
		return pickUpPoint;
	}

}
